package com.dragon.gallery_paging

import android.content.Context
import okhttp3.OkHttpClient

class OkhttpSingleton private constructor(context: Context) {
    private val okHttpClient: OkHttpClient? = null;
    //单例的标志object为饿汉式 ,companion object为懒汉式
    companion object {
        private var INSTANCE: OkhttpSingleton? = null
        fun getInstance(context: Context) =
            INSTANCE ?: synchronized(this) {
                OkhttpSingleton(context).also { INSTANCE = it }
            }
    }

    val call:OkHttpClient by lazy {
        OkHttpClient()
    }
}